// Problem: Luogu Bowls
// Url: https://www.luogu.com.cn/problem/CF36C
// T/M Limit: 2000ms 62MB
// Time: 2024-04-22 08:47:58
// Author: ShaoJia

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define rep(Ii,Jj,Kk) for(int Ii=(Jj),Ii##_=(Kk);Ii<=Ii##_;Ii++)
#define per(Ii,Jj,Kk) for(int Ii=(Jj),Ii##_=(Kk);Ii>=Ii##_;Ii--)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef double db;
#define fir first
#define sec second
#define siz(Aa) ((int)(Aa).size())
#define all(Aa) (Aa).begin(),(Aa).end()
#define ckmx(Aa,Bb) (Aa=max(Aa,Bb))
#define ckmn(Aa,Bb) (Aa=min(Aa,Bb))
#define Fi(s) freopen(s,"r",stdin)
#define Fo(s) freopen(s,"w",stdout)
#define Fre(s) Fi(s".in"),Fo(s".out")
const int N=3010;
db ans=0;
pair<int,db> L[N],R[N];
int n=0;
signed main(){ios::sync_with_stdio(false),cin.tie(nullptr);
#ifndef SuperAnton
  Fi("wan.in");
  Fo("wan.out");
#endif
  int T;cin>>T;
  while(T--){
    db h;
    int l,r,x;
    cin>>x>>l>>r;
    h=x;
    db res=(n?L[n].sec:0);
    while(n && R[n].fir<=l){
      ckmx(res,R[n].sec);
      n--;
    }
    if(n && L[n].fir<=l){
      ckmx(res,
        (L[n].sec*(R[n].fir-l)+R[n].sec*(l-L[n].fir))
          /
        (R[n].fir-L[n].fir)
      );
    }
    while(n && L[n].fir<=r){
      if(L[n].fir>=l){
        ckmx(res,
          L[n].sec-
          h*(L[n].fir-l)/(r-l)
        );
      }
      if(R[n].fir>r){
        ckmx(res,
          (L[n].sec*(R[n].fir-r)+R[n].sec*(r-L[n].fir))
            /
          (R[n].fir-L[n].fir)
          -h
        );
        break;
      }
      ckmx(res,
        R[n].sec-
        h*(R[n].fir-l)/(r-l)
      );
      n--;
    }
    ckmx(ans,res+h);
    n++;
    L[n]=make_pair(l,res);
    R[n]=make_pair(r,res+h);
    // cout<<"placed "<<10-T<<":\n";
    // per(i,n,1) cout<<"Segment "<<L[i].fir<<" "<<L[i].sec<<" "<<R[i].fir<<" "<<R[i].sec<<"\n";
  }
  cout<<fixed<<setprecision(12)<<ans<<"\n";
return 0;}
/*
*/